home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-11 | 1.3 KB | 49 lines | [TEXT/CWIE] |
- //
- // CDrawContextMaker.cp
- //
-
- #include "CDrawContextMaker.h"
-
- CDrawContextMaker::CDrawContextMaker( CGrafPtr inWindow, Rect &inFrame )
- {
- // (Perhaps we can init the TQ3DrawContextData struct from a resource.)
- // (The window part has to be done by hand.)
- Assert_( inWindow != nil );
-
- // data is a reference into the TQ3MacDrawContextData (easier to type)
- TQ3DrawContextData & data = mData.drawContextData;
-
- // Fill in draw context data.
- data.clearImageMethod = kQ3ClearMethodWithColor;
- ::Q3ColorARGB_Set( & data.clearImageColor, 1.0, 0.0, 0.0, 0.0 );
-
- // the area of the pane
- ::Q3Point2D_Set( &data.pane.min, inFrame.left, inFrame.top );
- ::Q3Point2D_Set( &data.pane.max, inFrame.right, inFrame.bottom );
- data.paneState = kQ3True; // so the area data will be used
- data.maskState = kQ3False;
- data.doubleBufferState = kQ3True;
-
- // this is the window associated with the view
- mData.window = inWindow;
- mData.library = kQ3Mac2DLibraryNone;
- mData.viewPort = nil;
- mData.grafPort = nil;
- }
-
- void CDrawContextMaker::SetClearImageColor(TQ3ColorARGB &inColor)
- {
- Q3Forget( mObject ); // if we changed the color, dispose of any old object
- mData.drawContextData.clearImageColor = inColor;
- }
-
- void CDrawContextMaker::Make()
- {
- TQ3DrawContextObject theContext ;
-
- theContext = ::Q3MacDrawContext_New( &mData ) ;
- ThrowIfNil_(theContext);
-
- mObject = theContext;
- }
-